import path from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
import eslint from 'vite-plugin-eslint';

export default defineConfig({
  plugins: [
    react(),
    svgr(),
    eslint({
      cache: true, // 启用缓存
      include: ['src/**/*.ts', 'src/**/*.tsx'], // 限定检查范围
      exclude: ['vite.config.js']
    })
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  test: {
    globals: true,
    environment: 'jsdom',
    setupFiles: './src/setupTests.js'
  }
});
